import React from 'react'
import { NavBar } from 'antd-mobile'
import { ProductCard, SubmitBar } from 'react-vant';
import axios from '../../api/index'

function Index() {
  const onSubmit=async()=>{
    const res=await axios.get('/api/pay',{params:{id:1,title:'下单支付',price:200}})
    console.log(res) 
    const {code,data,message}=res.data
    if(code==200){
      window.open(data)
    }else{
      alert(message)
    }
  }
  return (
    <div>
      <NavBar>确认收货</NavBar>
      <div>
        <span>可以选择多个收货地址</span>
      </div>
      <div>
        <ProductCard
          num="2"
          price="2.00"
          desc="描述信息"
          title="商品名称"
          thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
        />
      </div>
      <div>
      <SubmitBar price="75800" buttonText="提交订单" onSubmit={onSubmit}/>
      </div>
    </div>
  )
}

export default Index